from django.db import models


class User(models.Model):
    user_name = models.CharField(max_length=31)
    email = models.CharField(max_length=63)
    password = models.CharField(max_length=31)
    user_type = models.CharField(max_length=7, default="normal")
    scholar_id = models.CharField(max_length=15, null=True)
    introduction = models.TextField(null=True)
    scholar_name = models.CharField(max_length=63, null=True)
    is_claiming = models.BooleanField(default=False)

    def parse_dict(self):
        return {
            "user_id": self.id,
            "user_name": self.user_name,
            "email": self.email,
            "user_type": self.user_type,
            "scholar_id": self.scholar_id,
            "introduction": self.introduction,
            "scholar_name": self.scholar_name,
            "is_claiming": self.is_claiming
        }
